
<?php 
	require_once($_SERVER['DOCUMENT_ROOT'] . '/Prototipo/conexao/ConexaoBanco.php');
	require_once($_SERVER['DOCUMENT_ROOT'] . '/Prototipo/controle/NoticiasController.php');
	require_once($_SERVER['DOCUMENT_ROOT'] . '/Prototipo/modelo/TipoNoticia.php');
	//include_once '../modelo/Noticia.php';
	$controle = new NoticiasController();
	$tipoNoticia = new TipoNoticia();
	$banco = new ConexaoBanco();
	$banco->conectar();
?>
<div class="form">
	<!-- dentro do recebePost() coloque a ação que será executada -->
	<form method="post" enctype="multipart/form-data" action="<?php $controle->recebePost('cadastrar');?>">

	<fieldset>
		<legend>Cadastrar Notícia</legend>
				<div class="control-group">
					<label class="control-label">Título</label>
					<div class="controls">
						<input name="titulo" class="span9" type="text" id="titulo" size="70">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">Descrição</label>
					<div class="controls">
						<input name="descricao" class="span9" type="text" id="descricao" size="70">
					</div>
				</div>
				
				<div class="control-group">
					<label class="control-label">Categoria</label>
					<div class="controls">
						<select name='id_tipo_noticia' id='id_tipo_noticia'>
							<option selected>Selecione a Categoria</option>
								<?php
								$rs = $banco->executarConsulta("select * from tipo_noticia order by id_tipo_noticia");
								while($row = mysql_fetch_array($rs)){
									$tipoNoticia->setIdTipoNoticia($row['id_tipo_noticia']);
									$tipoNoticia->setDescricao($row['tipo_noticia']);

								?>
								<option value="<?php echo $tipoNoticia->getIdTipoNoticia(); ?>">
									<?php echo $tipoNoticia->getDescricao(); ?>
								</option>
								<?php }	
							?>
						</select>
					</div>
				</div>
			
				<div class="control-group">
					<label class="control-label">Destaque</label>
					<div class="controls">
						<select class="span1" name='destaque' id='destaque'>
							<option value="1" selected>Sim</option>
							<option value="0">Não</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">Matéria</label>
					<div class="controls">
						<script type="text/javascript">
							var ckeditor = CKEDITOR.replace( 'NoticiaConteudo' );
						</script>
						<textarea name="NoticiaConteudo" class="ckeditor" cols="42" rows="15" ></textarea>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">Status</label>
					<div class="controls">
						<select class="span1" name='status' id='ativo'>
							<option value="1" selected>Sim</option>
							<option value="0">Não</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">Imagem</label>
					<div class="controls">
						<input type="file" class="input-xlarge" name="nome_arquivo" id="nome_arquivo">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">Legenda</label>
					<div class="controls">
						<input name="legenda" class="span9" type="text" id="subtitulo" size="70">
					</div>
				</div>
				
				<div class="controls">
					<input name="id_noticia" type="hidden" value="<? //echo $id_noticia; ?>"> 
					<input type=submit class="btn btn-inverse" name='submit'>
				</div>
				
	</fieldset>
</form>
	</div>
	<?php $banco->desconectar();?>